<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <link rel="stylesheet" href="<%=request.getContextPath()%>/js/css/bootstrap.min.css">
    
    <title>jsp</title>
	
	
  </head>

<body>
	 <table align="center">
		<tr>
			<td>部门名称</td>
			<td>优先级</td>
			<td align="center">编辑</td>
			<td>编辑</td>
		</tr>
		<c:forEach items = "${deptlist }" var = "dept"  >
		<tr id= ${dept.id }>
		    <td> <input type="text" value=${dept.deptName } readOnly="true" name="${dept.id }"/></td>
		    <td> <input type="text" value=${dept.ord  } readOnly="true" name="${dept.id }"/></td>
		    <!--方法二 POST传参-->
		    <td><input type="button" value = "修改" id="editbtn"  onclick="edit(this)" />
		</tr>
		
		</c:forEach>
	</table> 
   <%--  <table>
      <c:forEach items = "${deptlist }" var = "dept"  >
		<tr>
		    <td>${dept.deptName }</td>
		    <td>${dept.ord }</td>
		     <!--方法一 地址栏传参 -->
		    <td align ="center"><a href="./editdept?id=${dept.id }">修改</a>&nbsp<a href="./deldept?id=${dept.id }">删除</a></td> 
		     <!--方法二 POST传参-->
		    <td><input type="button" value = "修改" id="editbtn"  onclick="edit('${dept.id}')" />
		</tr>
    </table>
 --%>

</body>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/js/bootstrap.min.js"></script>
<script language="javascript"> 
function edit(btn){
    var $row=$($(btn).parents("tr"));
	var id=$row.attr("id");
	var inputList = document.getElementsByname("id");
	inputList.reOnly = false ;
	
	
}
</script>
</html>
